import java.util.Scanner;

/**
 * Created with IDEA
 * author:ju bai
 * Date:2021/4/19
 * Time:21:27
 **/
public class Main2 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int[] arr = new int[n];
        while (sc.hasNext()) {
            for (int i = 0; i < n; i++) {
                arr[i] = sc.nextInt();
            }
            for (int i = 0; i < n; i++) {
                toFind(arr, arr[i], i);
            }
        }
    }

    /**
     * 每日一题-单调栈结构
     *
     * @param arr
     * @param num
     * @param i
     */
    private static void toFind(int[] arr, int num, int i) {
        int left = -1;
        int right = -1;
        //找到右边比arr[i]小的值
        for (int j = i + 1; j < arr.length; j++) {//从0-arr.length，往后走
            if (arr[j] < num) {
                right = j;
                break;
            }
        }
        //找到左边比arr[i]小的值
        for (int j = i; j >= 0; j--) {//往前走
            if (arr[j] < num) {
                left = j;
                break;
            }
        }
        System.out.println(left + " " + right);
    }
}